import codecs,time,sys
import git


repo = git.Repo(r"C:\\Users\\hb\\Desktop\\modules")

# the below gives us all commits
repo.iter_commits()

fp = codecs.open('difffile.txt','w','utf-8')  
# take the first and last commit
newerCommit=None
for i in repo.iter_commits():
    if newerCommit == None:
        newerCommit = i
        continue
    #fp.write(i.author)
    #fp.write(time.asctime(i.authored_date))
    #fp.write(time.asctime(i.committed_date))
    if repo.git.diff(i,newerCommit).find(sys.argv[1])>=0:
        fp.write(i.message)
        fp.write(repo.git.diff(i,newerCommit))
    newerCommit = i

fp.close()    

# now get the diff
